import java.io.Serializable;
import java.util.Objects;

/**
 * @author dragon
 * @version 1.0
 * @description
 * @date created in 2018-11-13
 */
public class Student extends Person implements Serializable {

    /**
     * 学生姓名
     */
    private String name;

    /**
     * 学生年级
     */
    private Integer age;

    /**
     * 班级名称
     */
    private String classesName;


    public Student(String classesName) {
        this.classesName = classesName;
    }

    public Student() {
    }

    public String getClassesName() {
        return classesName;
    }

    public void setClassesName(String classesName) {
        this.classesName = classesName;
    }

    @Override
    public String test() throws RuntimeException {
        System.out.println("子类方法运行了");
        return "asdf";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Student student = (Student) o;

        return Objects.equals(name, student.name) &&
                Objects.equals(age, student.age) &&
                Objects.equals(classesName, student.classesName);
    }

    @Override
    public int hashCode() {

        return Objects.hash(name, age, classesName);
    }
}
